<template>
  <div id="topSearch">
    <div class="search-box">
      <el-form
        :inline="true"
        :model="formInline"
        ref="ruleForm"
        class="demo-form-inline"
      >
        <el-form-item label="所属模块" prop="type">
          <el-select size="small" v-model="formInline.type" clearable>
            <el-option
              v-for="(item, index) in modularList"
              :key="index"
              :label="item.dictLabel"
              :value="item.dictValue"
            >
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="发布状态:" prop="status">
          <el-select size="small" v-model="formInline.status" clearable>
            <el-option
              v-for="(item, index) in statusList"
              :key="index"
              :label="item.dictLabel"
              :value="item.dictValue"
            >
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="标题搜索:" prop="title">
          <el-input
            size="small"
            v-model="formInline.title"
            placeholder="请输入文字内容查询"
            clearable
          ></el-input>
        </el-form-item>
        <el-form-item class="s-btn">
          <el-button type="success" icon="el-icon-search" @click="toSearch">
            查询
          </el-button>
          <el-button type="success" plain @click="resetForm('ruleForm')">
            重置
          </el-button>
        </el-form-item>
      </el-form>
    </div>
  </div>
</template>
<script>
import { sysNormalDisable } from '@utils/dictionariesFunc'
export default {
  data() {
    return {
      formInline: {
        type: '',
        status: '',
        title: ''
      },
      modularList: [{ dictLabel: '全部', dictValue: '' }],
      statusList: [
        { dictLabel: '全部', dictValue: '' },
        { dictLabel: '未发布', dictValue: 'CLOSE' },
        { dictLabel: '已发布', dictValue: 'OPEN' }
      ]
    }
  },
  async mounted() {
    const resmodule = await sysNormalDisable('dapeng_info_desk')
    this.modularList = this.modularList.concat(resmodule)
  },
  methods: {
    toSearch() {
      this.$emit('toSearch', this.formInline)
    },
    resetForm(formName) {
      this.$refs[formName].resetFields()
    }
  }
}
</script>
<style lang="less" scoped></style>
